import 'package:fate_blind_box/theme/theme_color.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class ActPublishItemView extends StatelessWidget {
  String leftName = ''; //左侧标题
  String placeName = ''; //占位符
  bool isShowLine = true;
  TextEditingController? inputController;
  bool isCanEdit = false;
  Function?callBack;

  ActPublishItemView(
      {this.leftName = '',
      this.placeName = '',
      this.isShowLine = true,
      this.inputController,
      this.isCanEdit = false,
        this.callBack,
      Key? key})
      : super(key: key);
  Color placeColor = const Color(0xFF979797);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        if(callBack!=null){
          callBack!();
        }
      },
      child: Container(
        margin: EdgeInsets.symmetric(horizontal: 14.w),
        padding: EdgeInsets.only(top: 14.w),
        child: Column(
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                RichText(
                  text: TextSpan(
                      text: leftName,
                      style: TextStyle(
                          fontSize: 16, color: ThemeColor.black1414Color),
                      children: const [
                        TextSpan(text: '*', style: TextStyle(color: Colors.red))
                      ]),
                ),
                Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    SizedBox(
                      width: 200,
                      child: TextField(
                        enabled: isCanEdit,
                        controller: inputController,
                        textAlign: TextAlign.end,
                        maxLines: 1,
                        style: const TextStyle(color: Colors.black,fontSize: 13,overflow: TextOverflow.ellipsis,),
                        decoration: InputDecoration(
                          hintStyle: TextStyle(color: placeColor, fontSize: 13),
                          isCollapsed: true,
                          border: InputBorder.none,
                          hintText: placeName,
                        ),
                      ),
                    ),
                    Padding(
                      padding: const EdgeInsets.only(top: 3),
                      child: Icon(
                        Icons.arrow_forward_ios_rounded,
                        size: 18,
                        color: placeColor,
                      ),
                    ),
                  ],
                ),
              ],
            ),
            SizedBox(
              height: 10.w,
            ),
            Visibility(
              visible: isShowLine,
              child: Container(
                height: 0.5,
                color: ThemeColor.lineColor,
              ),
            )
          ],
        ),
      ),
    );
  }
}
